package com.eportal.action.background;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import com.eportal.action.BaseAction;
import com.eportal.domain.Sysroles;
import com.eportal.domain.UsersLoginOut;
import com.eportal.service.TUserLoginLogService;
import com.framework.jqgrid.JqGridPager;
import com.opensymphony.xwork2.ModelDriven;

/**
 * 住户App登录日志管理
 * @author chencheng
 *
 */
public class TUserLoginLogAction extends BaseAction implements ModelDriven<UsersLoginOut> {

    /**
	 * @author chencheng
	 */
	private static final long serialVersionUID = 1L;

	private static Logger log = Logger.getLogger(TUserLoginLogAction.class.getName());

    private Map<String, Object> result = new HashMap<String, Object>();

    @Autowired
    TUserLoginLogService tUserLoginLogService;
    
    /**
     * 住户App登录日志管理
     */
    public String listView() {
        return SUCCESS;
    }
    
    /**
     * 住户App登录日志列表
     */
    public void page() throws Exception {
        JqGridPager jqGridPager = new JqGridPager();
//        //合作方名称
//    	String agtname = getRequest().getParameter("agtname");
//    	//时间范围
//    	String ptime1 = getRequest().getParameter("ptime1");
//    	String ptime2 = getRequest().getParameter("ptime2");
//    	StringBuilder where = new StringBuilder(" 1=1 ");
//    	if (agtname != null && !agtname.equals("")) {
//        	where.append(" and tagent.agtname like '%");
//        	where.append(agtname);
//        	where.append("%'");
//        }
//    	if (ptime1 != null && !ptime1.equals("")) {
//            where.append(" and tagent.operatetime >= to_date( '");
//            where.append(ptime1);
//            where.append("' ,'yyyy-mm-dd') ");
//        }
//        if (ptime2 != null && !ptime2.equals("")) {
//        	 where.append(" and tagent.operatetime <= to_date( '");
//	            where.append(ptime2);
//	            where.append("' ,'yyyy-mm-dd') ");
//        }
//    	jqGridPager.setWhere(where.toString());
        setPage(getRequest(), jqGridPager);
        List<UsersLoginOut> tOpenLog = tUserLoginLogService.list(jqGridPager);
        jqGridQueryMap(UsersLoginOut.class, getRequest(), tOpenLog, getResponse(), jqGridPager);
    }
    
    
    
    private UsersLoginOut usersLoginOut = new UsersLoginOut();

    @Override
    public UsersLoginOut getModel() {
        return usersLoginOut;
    }
}
